
function reduce(path, data) {
    path.split('.').reduce((next, vo) => {
        if (next[vo] !== undefined) {
            return next[vo];
        }
        return defaultValue;
    }, data);
}

export default {
    filters: {
        link(val, data, style) {
            const keys = Object.keys(val);
            let props = {};
            for (let i = 0; i < keys.length; i++) {
                const key = keys[i];
                const { mode = 0, path = '', value = '' } = val[key];
                if (mode === 0) {
                    props[key] = value;
                } else {
                    props[key] = reduce(path, data);
                }
            }
            props['enstyle'] = style;
            console.log('props===>', props);
            return props;
        }
    }
}